<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="kubernetes,ops" />
	<meta name="description" content="Deploy Seata Server By Kubernetes" />
	<!-- 网页标签标题 -->
	<title>Deploy Seata Server By Kubernetes</title>
  <link rel="shortcut icon" href="/img/seata_logo_small.jpeg"/>
	<link rel="stylesheet" href="/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/en-us/index.html"><img class="logo" src="/img/seata_logo.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><span class="language-switch language-switch-normal">中</span><div class="header-menu"><img class="header-menu-toggle" src="/img/system/menu_gray.png"/><ul><li class="menu-item menu-item-normal"><a href="/en-us/index.html" target="_self">HOME</a></li><li class="menu-item menu-item-normal menu-item-normal-active"><a href="/en-us/docs/overview/what-is-seata.html" target="_self">DOCS</a></li><li class="menu-item menu-item-normal"><a href="/en-us/docs/developers/developers_dev.html" target="_self">DEVELOPERS</a></li><li class="menu-item menu-item-normal"><a href="/en-us/blog/index.html" target="_self">BLOG</a></li><li class="menu-item menu-item-normal"><a href="/en-us/community/index.html" target="_self">COMMUNITY</a></li><li class="menu-item menu-item-normal"><a href="/en-us/blog/download.html" target="_self">DOWNLOAD</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="https://img.alicdn.com/tfs/TB1cm8nJwDqK1RjSZSyXXaxEVXa-160-160.png" class="front-img"/><span>Documentation</span><img src="https://img.alicdn.com/tfs/TB1cm8nJwDqK1RjSZSyXXaxEVXa-160-160.png" class="back-img"/></div></div><section class="content-section"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>Overview</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/overview/what-is-seata.html" target="_self">What is Seata?</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/overview/terminology.html" target="_self">Terminology</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/overview/faq.html" target="_self">FAQ</a></li></ul></li><li class="menu-item menu-item-level-1"><span>User Doc</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/user/quickstart.html" target="_self">Quick Start</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/user/api.html" target="_self">API Guide</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/user/microservice.html" target="_self">Microservices Framework Supports</a></li></ul></li><li class="menu-item menu-item-level-1"><span>Developer Guide</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Transaction Mode<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/dev/mode/at-mode.html" target="_self">Seata AT mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/dev/mode/tcc-mode.html" target="_self">Seata TCC mode</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/dev/mode/saga-mode.html" target="_self">Seata Saga mode</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/dev/seata-mertics.html" target="_self">Metrics design</a></li></ul></li><li class="menu-item menu-item-level-1"><span>Ops Guide</span><ul><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><a href="/en-us/docs/ops/multi-configuration-isolation.html" target="_self">Configuration Isolation</a></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Deploy<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/system/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-server.html" target="_self">Deploy Directly</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-by-docker.html" target="_self">Deploy by Docker</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-by-kubernetes.html" target="_self">Deploy by Kubernetes</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/ops/deploy-by-helm.html" target="_self">Deploy by Helm</a></li></ul></li></ul></li></ul></div><div class="doc-content markdown-body"><h1>Deploy Seata Server By Kubernetes</h1>
<h3>Quick Start</h3>
<p>Create file <code>seata-server.yaml</code></p>
<pre><code class="language-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Service</span>
<span class="hljs-attr">metadata:</span>
<span class="hljs-attr">  name:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">  namespace:</span> <span class="hljs-string">default</span>
<span class="hljs-attr">  labels:</span>
<span class="hljs-attr">    k8s-app:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">spec:</span>
<span class="hljs-attr">  type:</span> <span class="hljs-string">NodePort</span>
<span class="hljs-attr">  ports:</span>
<span class="hljs-attr">    - port:</span> <span class="hljs-number">8091</span>
<span class="hljs-attr">      nodePort:</span> <span class="hljs-number">30091</span>
<span class="hljs-attr">      protocol:</span> <span class="hljs-string">TCP</span>
<span class="hljs-attr">      name:</span> <span class="hljs-string">http</span>
<span class="hljs-attr">  selector:</span>
<span class="hljs-attr">    k8s-app:</span> <span class="hljs-string">seata-server</span>

<span class="hljs-meta">---</span>

<span class="hljs-attr">apiVersion:</span> <span class="hljs-string">apps/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Deployment</span>
<span class="hljs-attr">metadata:</span>
<span class="hljs-attr">  name:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">  namespace:</span> <span class="hljs-string">default</span>
<span class="hljs-attr">  labels:</span>
<span class="hljs-attr">    k8s-app:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">spec:</span>
<span class="hljs-attr">  replicas:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">  selector:</span>
<span class="hljs-attr">    matchLabels:</span>
<span class="hljs-attr">      k8s-app:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">  template:</span>
<span class="hljs-attr">    metadata:</span>
<span class="hljs-attr">      labels:</span>
<span class="hljs-attr">        k8s-app:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">    spec:</span>
<span class="hljs-attr">      containers:</span>
<span class="hljs-attr">        - name:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">          image:</span> <span class="hljs-string">docker.io/seataio/seata-server:latest</span>
<span class="hljs-attr">          imagePullPolicy:</span> <span class="hljs-string">IfNotPresent</span>
<span class="hljs-attr">          env:</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">SEATA_PORT</span>
<span class="hljs-attr">              value:</span> <span class="hljs-string">"8091"</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">STORE_MODE</span>
<span class="hljs-attr">              value:</span> <span class="hljs-string">file</span>
<span class="hljs-attr">          ports:</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">http</span>
<span class="hljs-attr">              containerPort:</span> <span class="hljs-number">8091</span>
<span class="hljs-attr">              protocol:</span> <span class="hljs-string">TCP</span>
</code></pre>
<pre><code class="language-bash">$ kubectl apply -f seata-server.yaml
</code></pre>
<h2>Custom configuration</h2>
<h3>Environment</h3>
<p>The environment is same with Docker, can reference <a href="./deploy-by-docker.md">Deploy Seata Server By Docker</a></p>
<h3>Use specify configuration file</h3>
<p>Can specify configuration file by mount files, like mount files under <code>/root/workspace/seata/seata-config/file</code> to pod. And need specify environment <code>SEATA_CONFIG_NAME</code> also, the value need start with <code>file:</code>, like <code>file:/root/seata-config/registry</code></p>
<ul>
<li>Deployment</li>
</ul>
<pre><code class="language-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">apps/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Deployment</span>
<span class="hljs-attr">metadata:</span>
<span class="hljs-attr">  name:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">  namespace:</span> <span class="hljs-string">default</span>
<span class="hljs-attr">  labels:</span>
<span class="hljs-attr">    k8s-app:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">spec:</span>
<span class="hljs-attr">  replicas:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">  selector:</span>
<span class="hljs-attr">    matchLabels:</span>
<span class="hljs-attr">      k8s-app:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">  template:</span>
<span class="hljs-attr">    metadata:</span>
<span class="hljs-attr">      labels:</span>
<span class="hljs-attr">        k8s-app:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">    spec:</span>
<span class="hljs-attr">      containers:</span>
<span class="hljs-attr">        - name:</span> <span class="hljs-string">seata-server</span>
<span class="hljs-attr">          image:</span> <span class="hljs-string">docker.io/seataio/seata-server:latest</span>
<span class="hljs-attr">          imagePullPolicy:</span> <span class="hljs-string">IfNotPresent</span>
<span class="hljs-attr">          env:</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">SEATA_PORT</span>
<span class="hljs-attr">              value:</span> <span class="hljs-string">"8091"</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">STORE_MODE</span>
<span class="hljs-attr">              value:</span> <span class="hljs-string">file</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">SEATA_CONFIG_NAME</span>
<span class="hljs-attr">              value:</span> <span class="hljs-attr">file:/root/seata-config/registry</span>
<span class="hljs-attr">          ports:</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">http</span>
<span class="hljs-attr">              containerPort:</span> <span class="hljs-number">8091</span>
<span class="hljs-attr">              protocol:</span> <span class="hljs-string">TCP</span>
<span class="hljs-attr">          volumeMounts:</span>
<span class="hljs-attr">            - name:</span> <span class="hljs-string">seata-config</span>
<span class="hljs-attr">              mountPath:</span> <span class="hljs-string">/root/seata-config</span>
<span class="hljs-attr">      volumes:</span>
<span class="hljs-attr">        - name:</span> <span class="hljs-string">seata-config</span>
<span class="hljs-attr">          hostPath:</span>
<span class="hljs-attr">            path:</span> <span class="hljs-string">/root/workspace/seata/seata-config/file</span>
</code></pre>
</div></section><footer class="footer-container"><div class="footer-body"><img src="/img/seata_logo_gray.png"/><p class="docsite-power">website powered by docsite</p><div class="cols-container"><div class="col col-12"><h3>Vision</h3><p>Seata is an Alibaba open source distributed transaction solution that delivers high performance and easy to use distributed transaction services under a microservices architecture.</p></div><div class="col col-6"><dl><dt>Documentation</dt><dd><a href="/en-us/docs/overview/what-is-seata.html" target="_self">What is Seata?</a></dd><dd><a href="/en-us/docs/user/quickstart.html" target="_self">Quick Start</a></dd><dd><a href="https://github.com/seata/seata.github.io/issues/new" target="_self">Report a doc issue</a></dd><dd><a href="https://github.com/seata/seata.github.io" target="_self">Edit This Page on GitHub</a></dd></dl></div><div class="col col-6"><dl><dt>Resources</dt><dd><a href="/en-us/blog/index.html" target="_self">Blog</a></dd><dd><a href="/en-us/community/index.html" target="_self">Community</a></dd></dl></div></div><div class="copyright"><span>Copyright © 2019 Seata</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '';
  </script>
	<script src="/build/documentation.js"></script>
	<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?104e73ef0c18b416b27abb23757ed8ee";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
</body>
</html>
